import request from "@/utils/request";

/**
 * 获取验证码请求
 * @param {string} phone
 * @returns 验证码 code
 */
function reqGetCode(phone) {
  return request({
    method: "get",
    url: `/user/passport/sendCode/${phone}`, // path参数
  });
}
/**
 * 注册
 * @param {object} data  {phone，password}
 * @returns null
 */
function reqRegister(data) {
  return request({
    method: "post",
    url:'/user/passport/register',
    data,
  });
}
/**
 * 登录
 * @param {string} phone 手机号码
 * @param {string} password 密码
 * @returns 
 */
function reqLogin(phone,password) {  
  return request({
    method:'post',
    url:'/user/passport/login',
    data:{
      phone,
      password

    }
  })
}

function reqLoginOut() {  
  return request({
    method:'get',
    url:'/user/passport/logout',
  })
}
export { reqGetCode, reqRegister,reqLogin,reqLoginOut };
